package com.apex.wx.controller;

import com.apex.common.controller.BaseController;
import com.apex.security.api.entity.Pager;
import com.apex.wx.service.MessageApproveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Create by IntelliJ IDEA
 * 用户：王建
 * 日期：2018-4-8
 */
@Controller
@RequestMapping("/uc/schedule/message")
public class MessageApproveController extends BaseController{

    @Autowired
    private MessageApproveService service;

    @GetMapping("/list")
    @ResponseBody
    public String getList(HttpServletRequest request, Pager pager,String title){
        return service.index(pager,title,getUserId(request));
    }

    @GetMapping("/{id}/index")
    public String getEntity(ModelMap modelMap, @PathVariable("id")Integer id){
        service.entity(modelMap,id);
        return "mobile/index/schedule/notice";
    }

    @RequestMapping("/notice/index")
    public String getNoticeList(HttpServletRequest request,String title,ModelMap modelMap){
        Pager pager=new Pager();
        pager.setCurrent(1);
        pager.setRows(12);
        modelMap.put("info","notice");
        service.noticeIndex(modelMap,pager,title,getUserId(request));
        modelMap.put("pager",pager);
        return "mobile/index/schedule/list";
    }
}
